
            <!DOCTYPE html>
            <html lang="en">
            <head>
                <meta charset="UTF-8">
                <title>k8s-ingress 413 Request Entity Too Large</title>
            </head>
            <body>
            <a href="https://andyoung.blog.csdn.net">原作者博客</a>
            <div id="content_views" class="markdown_views prism-atom-one-light">
                    <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
                        <path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path>
                    </svg>
                    <p>k8s集群中，将图片或是文件上传到文件服务器上，</p> 
<p>可是大于1M是就会报错</p> 
<p>413 Request Entity Too Large</p> 
<p>参考文档：</p> 
<p>https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/annotations.md</p> 
<p>最新版的ingress部署是需要configmap和RBAC的。</p> 
<h4><a id="webnginxconf_14"></a>一、在web的nginx.conf中添加</h4> 
<p>client_body_buffer_size 50m;</p> 
<h4><a id="ingress_22"></a>二、修改各个服务中的ingress</h4> 
<p>添加注解配置</p> 
<p>nginx.ingress.kubernetes.io/proxy-body-size: 50m</p> 
<p><img src="https://i-blog.csdnimg.cn/blog_migrate/7c7c873eed3b65acd4c69956ebb0873e.png" alt="img"><br> 重启该服务</p> 
<h4><a id="_31"></a>三、验证：</h4> 
<p>进入Nginx-ingress的pod中查看</p> 
<p>发现</p> 
<p><img src="https://i-blog.csdnimg.cn/blog_migrate/6383b2b38b7776c1d1d30f6ee4eeed92.png" alt="img"></p> 
<p>cat -n /etc/nginx/nginx.conf | grep nginx</p> 
<p>head -372 /etc/nginx/nginx.conf</p>
                </div>
            </body>
            </html>
            